<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Mapping Hints</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Mapping Hints' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">runtime</a></li><li><a href="index.html#6">Chapter 6: Completion Resources</a></li><li><b>Mapping Hints</b></li></ul></div>
<p class="purpose">To transcribe mapping hints for the World Index into suitable packages.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>To put it mildly, this does nothing at all clever:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTMappingHints::compile</span><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">mapping_hint</span><span class="plain-syntax"> *</span><span class="identifier-syntax">hint</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">, </span><span class="identifier-syntax">mapping_hint</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-hrr.html#SP20" class="function-link"><span class="function-syntax">Hierarchy::completion_package</span></a><span class="plain-syntax">(</span><span class="constant-syntax">MAPPING_HINTS_HAP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">dir</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">as_dir</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_DIR_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">dir</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_AS_DIR_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">as_dir</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">dir</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_FROM_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">from</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_TO_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">to</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_DIR_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">dir</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="6-mh.html#SP1" class="function-link"><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_NAME_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_SCOPE_LEVEL_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">scope_level</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_SCOPE_INSTANCE_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">scope_I</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="6-mh.html#SP1" class="function-link"><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_TEXT_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">put_string</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_NUMBER_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">put_integer</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">annotation</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="6-mh.html#SP1" class="function-link"><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_ANNOTATION_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">annotation</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_POINT_SIZE_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">point_size</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="6-mh.html#SP1" class="function-link"><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_FONT_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">font</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="6-mh.html#SP1" class="function-link"><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_COLOUR_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">colour</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_OFFSET_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">inter_ti</span><span class="plain-syntax">) (</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">at_offset</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata_from_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">MH_OFFSET_FROM_HL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><a href="5-ins.html#SP1" class="function-link"><span class="function-syntax">RTInstances::value_iname</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">hint</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">offset_from</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RTMappingHints::apply_metadata_from_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">hl</span><span class="plain-syntax">, </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> *</span><span class="identifier-syntax">wide</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wide</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="string-syntax">"%w"</span><span class="plain-syntax">, </span><span class="identifier-syntax">wide</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-hrr.html#SP23" class="function-link"><span class="function-syntax">Hierarchy::apply_metadata</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">hl</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="6-pi.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-rm.html">1</a></li><li class="progresschapter"><a href="2-hrr.html">2</a></li><li class="progresschapter"><a href="3-gm.html">3</a></li><li class="progresschapter"><a href="4-enc.html">4</a></li><li class="progresschapter"><a href="5-act.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-bd.html">bd</a></li><li class="progresssection"><a href="6-tp.html">tp</a></li><li class="progresssection"><a href="6-tm.html">tm</a></li><li class="progresssection"><a href="6-pp.html">pp</a></li><li class="progresssection"><a href="6-pv.html">pv</a></li><li class="progresssection"><a href="6-abp.html">abp</a></li><li class="progresssection"><a href="6-pi.html">pi</a></li><li class="progresscurrent">mh</li><li class="progresssection"><a href="6-inf.html">inf</a></li><li class="progresschapter"><a href="7-cg.html">7</a></li><li class="progressnext"><a href="6-inf.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

